Crate cssparser_color
source ·Expand description
Fairly complete css-color implementation. Relative colors, color-mix, system colors, and other such things require better calc() support and integration.
Structs
- A color specified by the color() function. https://drafts.csswg.org/css-color-4/#color-function
- Default implementation of a
ColorParser
- Color specified by hue, saturation and lightness components.
- Color specified by hue, whiteness and blackness components.
- Color specified by lightness, a- and b-axis components.
- Color specified by lightness, chroma and hue components.
- Color specified by lightness, a- and b-axis components.
- Color specified by lightness, chroma and hue components.
- A color with red, green, blue, and alpha components, in a byte each.
Enums
- Either an angle or a number.
- Describes one of the value
values according to the CSS specification. - Either a number or a percentage.
Traits
- A trait that can be used to hook into how
cssparser
parses color components, with the intention of implementing more complicated behavior. - This trait is used by the
ColorParser
to construct colors of any type.
Functions
- https://drafts.csswg.org/css-color/#hsl-color except with h pre-multiplied by 3, to avoid some rounding errors.
- Return the named color with the given name.
- Parse a CSS color using the specified
ColorParser
and return a new color value on success. - Parse the color components and alpha with the modern [color-4] syntax.